/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.metadataRepository.repository.records.impl;

import cz.mzk.oai.metadataRepository.metadata.MetadataFormat;
import cz.mzk.oai.metadataRepository.repository.Identifier;
import cz.mzk.oai.metadataRepository.repository.collections.MetadataCollection;
import cz.mzk.oai.metadataRepository.repository.records.Record;
import cz.mzk.oai.metadataRepository.repository.records.presentAndDeleted.DeletedRecordsManager;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Martin Řehánek (rehan at mzk.cz)
 */
public class FileDeletedRecordsManager extends AbstractFileRecordsManager implements DeletedRecordsManager {

    private static final String METADATA_DIR_SUFFIX = "_deleted";

    public FileDeletedRecordsManager(MetadataCollection collection) {
        super(collection);
    }

    String getMetadataDirSuffix() {
        return METADATA_DIR_SUFFIX;
    }

    public FileRemovedRecord getRecord(Identifier identifier, MetadataFormat format) {
        File metadataDir = getMetadataDir(format);
        return new FileRemovedRecord(identifier, format, metadataDir, collection);
    }

    List<Record> createRecords(List<Identifier> idList, MetadataFormat format) {
        List<Record> result = new ArrayList<Record>(idList.size());
        for (Identifier id : idList) {
            FileRemovedRecord record = getRecord(id, format);
            result.add(record);
        }
        return result;
    }
}
